﻿<UserControl x:Class="UmlControlLibrary.UmlTree"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:MyControl="clr-namespace:UmlControlLibrary"
    Height="312"  Width="216">
    <UserControl.Resources>
        <DataTemplate DataType="{x:Type MyControl:UmlClass}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/class.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlInterface}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/interface.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />
            </StackPanel>
        </DataTemplate>

        <DataTemplate DataType="{x:Type MyControl:DiagramElement}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/class.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlProperty}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/attribute.png"/>
                <TextBlock Text="{Binding Path=ElementName}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlType}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/datatype.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlRelation}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/Arrow.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlRelationEnd}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/Arrow.png"/>
                <TextBlock Text="{Binding Path=Text}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlDiagram}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/ClassDiagram.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlModel}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/model.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>
        <DataTemplate DataType="{x:Type MyControl:UmlPackage}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Resources/Images/model.png"/>
                <TextBlock Text="{Binding Path=Name}" Margin="2,0,0,0" />

            </StackPanel>
        </DataTemplate>

    </UserControl.Resources>
    
    <Grid>
        <MyControl:UmlTreeView x:Name="RootTreeView" 
                               Items="{Binding Path=Childs}"
                               />
    </Grid>
</UserControl>
